<!-- 开放管理-预约资料-预警设定 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="8">
            <el-form-item label="日期">
              <el-date-picker v-model="fbillcredate" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                start-placeholder="开始日期" end-placeholder="结束日期">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="学校名称">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

         <template v-if="showAll">
          <el-col :span="6">
            <el-form-item label="课程名称">
              <el-input v-model="listQuery.fuser" placeholder="课程名称" clearable />
            </el-form-item>
          </el-col>
        </template>

          <el-col :span="6">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" >查询</el-button>
              <el-button type="success" icon="el-icon-plus" @click="insert(undefined)">新增</el-button>
              <!-- <el-button type="success" icon="el-icon-download">导出</el-button> -->
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FBILLNO" label="设定单号" width="95"></el-table-column>
          <el-table-column prop="FSRCNO" label="研学单号" width="95"></el-table-column>
          <!-- <el-table-column prop="FBILLCREDATE" label="设定日期" ></el-table-column> -->
          <el-table-column prop="FHOME" label="学校名称" ></el-table-column>
          <el-table-column prop="FCATNAME" label="课程名称" ></el-table-column>
          <el-table-column prop="FITEM" label="报警项目" width="85"></el-table-column>
          <el-table-column prop="FSCORE" label="报警范围" ></el-table-column>
          <el-table-column prop="FNOTE" label="报警说明" ></el-table-column>
          <!-- <el-table-column prop="FUPDDATE" label="刷新时间" width="135"></el-table-column> -->
          <el-table-column fixed="left" label="操作" align="center" width="115">
            <template slot-scope="scope">
              <el-button type="text" @click="insert(scope.row.FBILLNO)" size="small" icon="el-icon-edit">
                编辑
              </el-button>

              <el-popconfirm title="确定删除当前预约吗？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-s-delete" style="color: red;margin-left: 10px;"
                  type="text">删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"/>
        <Form ref="Form"  :formationlist="customlist" />
      </div>
    </div>
  </div>
</template>
<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll: false,
        fgrandname:"闵行春申小学",
        
        //所属校区选择数据
        options1: [{
          value: '20E01',
          label: '闵行春申小学'
        }, {
          value: '20E02',
          label: '闵行莘城中学'
        }, {
          value: '20N01',
          label: '闵行莘松中学'
        }, {
          value: '20N02',
          label: '闵行莘庄中学'
        }],

        customlist:[
          {
            "FBILLNO": "K241130001", 
            "FBILLCREDATE":"2024-11-30",
            "FUSER": "曹操",
            "FMEMO": "有机化学实验操作课",
            "FBEGDATE": "2024-12-01",
            "FENDDATE": "2025-11-30",
            "FCHECKUSE": "",
            "FCHECKDATE": "",
            "FNOTE":"",
            "FBILLSTATE": "申请中"
          },
        ],
        list: [
            {
            "FBILLNO": "K241130005", 
            "FSRCNO":"Y241130001",
            "FBILLCREDATE":"2024-11-30",
            "FCATNO": "SH240101", 
            "FCATNAME":"上海博物馆研学",
            "FUSER": "上海文化之旅研学机构",
            "FHOME": "闵行春申小学",
            "FITEM": "血压",
            "FSCORE": "收缩压:120~139,舒张压80~89",
            "FNOTE": "血压过高",
            "FUPDDATE":"2025-03-15 20:15:09"
            },{
            "FBILLNO": "K241130005", 
            "FSRCNO":"Y241130001",
            "FBILLCREDATE":"2024-11-30",
            "FCATNO": "SH240101", 
            "FCATNAME":"上海博物馆研学",
            "FUSER": "上海文化之旅研学机构",
            "FHOME": "闵行春申小学",
            "FITEM": "血氧",
            "FSCORE": "低于95%-100%",
            "FNOTE": "是否缺氧",
            "FUPDDATE":"2025-03-15 20:15:09"
            },{
            "FBILLNO": "K241130005", 
            "FSRCNO":"Y241130001",
            "FBILLCREDATE":"2024-11-30",
            "FCATNO": "SH240101", 
            "FCATNAME":"上海博物馆研学",
            "FUSER": "上海科技研学基地",
            "FHOME": "闵行春申小学",
            "FITEM": "心率",
            "FSCORE": "100~160",
            "FNOTE": "心率不稳定",
            "FUPDDATE":"2025-03-15 20:15:09"
            }
            ,{
            "FBILLNO": "K241130004", 
            "FSRCNO":"Y241130001",
            "FBILLCREDATE":"2024-11-30",
            "FCATNO": "SH240101", 
            "FCATNAME":"上海博物馆研学",
            "FUSER": "上海科技研学基地",
            "FHOME": "闵行春申小学",
            "FITEM": "体温",
            "FSCORE": ">38.5",
            "FNOTE": "注意是否感冒",
            "FUPDDATE":"2025-03-15 20:15:09"
            },{
            "FBILLNO": "K241130005", 
            "FSRCNO":"Y241130001",
            "FBILLCREDATE":"2024-11-30",
            "FCATNO": "SH240101", 
            "FCATNAME":"上海博物馆研学",
            "FUSER": "上海科技研学基地",
            "FHOME": "闵行春申小学",
            "FITEM": "行走",
            "FSCORE": "10000+",
            "FNOTE": "运动量有点大",
            "FUPDDATE":"2025-03-15 20:15:09"
            },
        ],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        total: 0,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fbillstate: "",
          fbillno: "",
          begindate: undefined,
          enddate: undefined,
          fcustomno: ""
        },
      };
    },
    computed: {},
    methods: {
      insert(id) {
        this.$refs.Form.init(id);
      },
    },
  };
</script>